package com.TwinBlade.PicturePassword;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.view.Display;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import java.io.File;
import java.io.FileInputStream;

public class SaveActivity extends Activity
{
  public static Button a;
  public static boolean b = false;
  private static boolean c = true;
  private static Activity d;
  private Bitmap e;
  private Handler f;
  private Runnable g;
  private Context h;

  private int a(BitmapFactory.Options paramOptions, int paramInt1, int paramInt2)
  {
    int i = paramOptions.outHeight;
    int j = paramOptions.outWidth;
    int k = 1;
    if ((i > paramInt2) || (j > paramInt1))
    {
      if (i > j)
        k = Math.round(j / paramInt1);
    }
    else
      return k;
    return Math.round(i / paramInt2);
  }

  private FrameLayout a(cs paramcs, bk parambk)
  {
    FrameLayout localFrameLayout = new FrameLayout(this);
    if (paramcs != null)
      localFrameLayout.addView(paramcs);
    while (true)
    {
      a = new Button(this);
      a.setText(getString(2131296397));
      a.setLayoutParams(new FrameLayout.LayoutParams(-1, -2, 81));
      a.setVisibility(8);
      a.setOnClickListener(new bj(this));
      localFrameLayout.addView(a);
      return localFrameLayout;
      if (parambk != null)
        localFrameLayout.addView(parambk);
    }
  }

  public static void a()
  {
    d.finish();
  }

  private void a(Intent paramIntent)
  {
    Bundle localBundle = paramIntent.getExtras();
    if (localBundle != null)
    {
      if (!"Save".equals(localBundle.getString("Code")))
        break label28;
      c = true;
    }
    label28: 
    while (!"Test".equals(localBundle.getString("Code")))
      return;
    c = false;
  }

  private void a(boolean paramBoolean, File paramFile)
  {
    BitmapFactory.Options localOptions = new BitmapFactory.Options();
    localOptions.inJustDecodeBounds = true;
    if (paramBoolean);
    try
    {
      FileInputStream localFileInputStream2 = openFileInput("PhotoData.jpg");
      BitmapFactory.decodeStream(localFileInputStream2, null, localOptions);
      localFileInputStream2.close();
      while (true)
      {
        label38: Display localDisplay = getWindowManager().getDefaultDisplay();
        localOptions.inSampleSize = a(localOptions, localDisplay.getWidth(), localDisplay.getHeight());
        localOptions.inJustDecodeBounds = false;
        if (paramBoolean);
        try
        {
          FileInputStream localFileInputStream1 = openFileInput("PhotoData.jpg");
          this.e = BitmapFactory.decodeStream(localFileInputStream1, null, localOptions);
          localFileInputStream1.close();
          return;
          BitmapFactory.decodeFile(paramFile.getPath(), localOptions);
          continue;
          this.e = BitmapFactory.decodeFile(paramFile.getPath(), localOptions);
          return;
        }
        catch (Exception localException1)
        {
        }
      }
    }
    catch (Exception localException2)
    {
      break label38;
    }
  }

  public static void b()
  {
    if (a != null)
      a.setVisibility(0);
  }

  private void e()
  {
    if (Environment.getExternalStorageState().equals("mounted"))
    {
      File localFile1 = getExternalFilesDir(null);
      if (localFile1 == null)
        localFile1 = new File(Environment.getExternalStorageDirectory() + "/PPAData");
      File localFile2 = new File(localFile1, "PhotoData.jpg");
      if (localFile2.exists())
      {
        a(false, localFile2);
        if (this.e != null)
          return;
      }
    }
    a(true, null);
  }

  public void finish()
  {
    if (b)
      setResult(-1);
    super.finish();
  }

  public void onCreate(Bundle paramBundle)
  {
    requestWindowFeature(1);
    getWindow().setFlags(2048, 2048);
    this.h = this;
    String str = PreferenceManager.getDefaultSharedPreferences(this).getString("ForceOrientation", "0");
    if (str.equals("0"))
      if (!Utilities.a())
        setRequestedOrientation(1);
    while (true)
    {
      super.onCreate(paramBundle);
      a(getIntent());
      d = this;
      this.f = new Handler();
      this.g = new bh(this);
      new bi(this).start();
      return;
      setRequestedOrientation(0);
      continue;
      if (str.equals("1"))
        setRequestedOrientation(1);
      else if (str.equals("2"))
        setRequestedOrientation(0);
    }
  }

  public void onDestroy()
  {
    super.onDestroy();
    if (this.e != null)
    {
      this.e.recycle();
      this.e = null;
    }
  }
}

/* Location:           D:\Studium\Bachelorarbeit\BA Marcus Wobig\BA\BA\Decompiler\PicturePassword APK\Programm\PicturePassword_dex2jar.jar
 * Qualified Name:     com.TwinBlade.PicturePassword.SaveActivity
 * JD-Core Version:    0.6.2
 */